/*
 heat-spectral lib. solves time-dependent PDEs using SEM-NI method.
 Copyright (C) 2009, Altieri Michele and Stefanoni Andrea
 Copyright (C) 2008, Proverbio Alessandro and Radice David

 This program is free software: you can redistribute it and/or modify
 it under the terms of the GNU General Public License as published by
 the Free Software Foundation, either version 3 of the License, or
 (at your option) any later version.
 
 This program is distributed in the hope that it will be useful,
 but WITHOUT ANY WARRANTY; without even the implied warranty of
 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
 GNU General Public License for more details.
 
 You should have received a copy of the GNU General Public License
 along with this program. If not, see <http://www.gnu.org/licenses/>.
*/

/**
    \file functions.cpp
    \brief Functors Implementation
*/

# include "functions.hpp"

namespace spectral {

// TensorProd

TensorProd::TensorProd(Poly const & f,
                       Poly const & g,
                       int idx,
                       int idy,
                       int odx,
                       int ody,
                       double weightX,
                       double weightY): _f(f),
                                        _g(g),
                                        _idx(idx),
                                        _idy(idy),
                                        _odx(odx),
                                        _ody(ody),
                                        _weightX(weightX),
                                        _weightY(weightY) {
    _f*=_weightX;
    _g*=_weightY;
}

TensorProd::TensorProd() {}

TensorProd::TensorProd(TensorProd const & fg) : _f(fg._f),
                                                _g(fg._g),
                                                _idx(fg._idx),
                                                _idy(fg._idy),
                                                _odx(fg._odx),
                                                _ody(fg._ody),
                                                _weightX(fg._weightX),
                                                _weightY(fg._weightY) {}

TensorProd & TensorProd::operator=(TensorProd const & tp) {
    _f=tp._f;
    _g=tp._g;
    _idx=tp._idx;
    _idy=tp._idy;
    _odx=tp._odx;
    _ody=tp._ody;
    _weightX=tp._weightX;
    _weightY=tp._weightY;
    return *this;
}

Poly TensorProd::operator[](int n) const {
    return ( (n==0) ? (_f) : (_g) );
}

} // namespace
